﻿@{Layout = "~/Views/Shared/_Layout.cshtml";}
@using Scheduling.Models

@if (Scheduling.Models.Helpers.UserHelper.GetAuthenticatedUser().UserGroup.Name == "Users")
{
    @Html.ActionLink("ChangePassword", "UpdatePasswordForUser", new { inUserID = Scheduling.Models.Helpers.UserHelper.GetAuthenticatedUserID() })
}
else
{
<h1>List Users</h1>
@Html.ActionLink("Add User", "Add")
<table class="Table" cellspacing="0">
    <tr>
        <th>Initials</th>
        <th>Name</th>
        <th>Department</th>
        <th></th>
    </tr>
   
    @{foreach (var user in ViewData.Model)
      {
        <tr onclick="location.href='@Href("~/User/Show/" + user.ID)'" class="Clickable">
            <td style="width:50px;">
                @user.ID
            </td>
            <td style="width:150px;">
                @user.FirstName @user.LastName
            </td>
            <td>
                @user.Department.Name
            </td> 
            <td>
                @Html.ActionLink("Edit", "Edit", new { Id = user.ID })
            </td>
            <td>
                @Html.ActionLink("Delete", "Remove", new { Id = user.ID })
            </td>
        </tr>
      }
    }
    </table>
}
